load("@fbsource//tools/build_defs/android:fb_xplat_android_cxx_library.bzl", "fb_xplat_android_cxx_library")
load("@fbsource//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")

fb_xplat_android_cxx_library(
    name = "trace_writer",
    srcs = [
        "BufferFileMapHolder.cpp",
        "MmapBufferTraceWriter.cpp",
        "jni.cpp",
    ],
    headers = [
        "BufferFileMapHolder.h",
    ],
    header_namespace = "profilo/mmapbuf/writer",
    exported_headers = [
        "MmapBufferTraceWriter.h",
    ],
    allow_jni_merging = True,
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo/MmapBufferTraceWriter\"",
        "-O3",
        #"-DFBLOG_NDEBUG=0",  # verbose logging
    ],
    labels = [],
    soname = "libprofilo_mmap_file_writer.$(ext)",
    tests = [
        profilo_path("cpp/test/mmapbuf/writer:trace_writer"),
    ],
    visibility = [
        "//fbandroid/libraries/profilo/java/main/com/facebook/profilo/...",
        profilo_path("cpp/test/mmapbuf/writer:trace_writer"),
    ],
    deps = [
        profilo_path("cpp:profilo"),
        profilo_path("cpp/generated:cpp"),
        profilo_path("cpp/jni:writer_callbacks"),
        profilo_path("cpp/logger/buffer:buffer"),
        profilo_path("cpp/mmapbuf/header:header"),
        profilo_path("cpp/util:util"),
        profilo_path("cpp/writer:trace_headers"),
        profilo_path("cpp/writer:writer"),
        profilo_path("deps/fbjni:fbjni"),
        profilo_path("deps/fb:fb"),
    ],
)
